﻿using Castle.Aop.InjectionHub;
using Castle.Aop.IService;
using Castle.Aop.Service;
using Microsoft.Extensions.DependencyInjection;

public class Program
{
    public static void Main(string[] args)
    {
        // IServiceCollection: 用于配置和注册服务。
        // IServiceProvider: 用于解析和获取服务实例。

        // IServiceCollection 用于定义和注册服务，而 IServiceProvider 用于解析和获取那些已注册的服务。
        IServiceCollection services = new ServiceCollection();
        services.AddInjection();
        IServiceProvider serviceProvider = services.BuildServiceProvider();
        IDemoService demoService = serviceProvider.GetService<IDemoService>();
        demoService.test();

        TestService testService = serviceProvider.GetService<TestService>();
        testService.info();
        Console.WriteLine();
    }
}